
#ifndef _VALUEPAIR_H
#define _VALUEPAIR_H

#include "radius_cdef.h"
#include "lutil.h"
#include "radius.h"


RADIUS_BEGIN_DECL


typedef struct value_pair {
	char			name[32];
	int			attribute;
	int			type;
	int			length; /* of strvalue */
	uint32_t		lvalue;
	int			operator;
	int			addport;
	uint8_t			strvalue[MAX_STRING_LEN];
	struct value_pair	*next;
} VALUE_PAIR;

/* valuepair.c */
VALUE_PAIR	*paircreate(int attr, int type);
void		pairfree(VALUE_PAIR **);
VALUE_PAIR	*pairfind(VALUE_PAIR *, int);
void		pairdelete(VALUE_PAIR **, int);
void		pairadd(VALUE_PAIR **, VALUE_PAIR *);
VALUE_PAIR	*paircopy(VALUE_PAIR *vp);
VALUE_PAIR	*paircopy2(VALUE_PAIR *vp, int attr);
void		pairmove(VALUE_PAIR **to, VALUE_PAIR **from);
void		pairmove2(VALUE_PAIR **to, VALUE_PAIR **from, int attr);
VALUE_PAIR	*pairmake(const char *attribute, const char *value, int operator);
VALUE_PAIR	*pairread(char **ptr, int *eol);
int		userparse(char *buffer, VALUE_PAIR **first_pair);


RADIUS_END_DECL

#endif 